package com.lyd.productanalyse.entity;

import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 描述 产品信息
 *
 * @author liyadong
 * @created 2023-11-20 13:20
 */
@Data
public class ProductDomain implements Serializable {
    @ExcelProperty(index = 0, value = "PO")
    private String po;
    @ExcelProperty(index = 1, value = "Line")
    private String line;
    @ExcelProperty(index = 2, value = "Packing Slip")
    private String packingSlip;
    @ExcelProperty(index = 3, value = "Rel")
    private String rel;
    @ExcelProperty(index = 4,value = "Supplier ID")
    private String supplierId;
    @ExcelProperty(index = 5, value = "Name")
    private String name;
    @ExcelProperty(index = 6, value = "Trans_Date")
    private String transDate;
    @ExcelProperty(index = 7, value = "FY")
    private String fy;
    @ExcelProperty(index = 8, value = "Part")
    private String part;
    @ExcelProperty(index = 9, value = "Description")
    private String description;
    @ExcelProperty(index = 10, value = "ClassID")
    private String classId;
    @ExcelProperty(index = 11, value = "Rev")
    private String rev;
    @ExcelProperty(index = 12, value = "Trans_Type")
    private String transType;
    @ExcelProperty(index = 13, value = "Whse")
    private String whse;
    @ExcelProperty(index = 14, value = "Bin")
    private String bin;
    @ExcelProperty(index = 15, value = "Trans_Class")
    private String transClass;
    @ExcelProperty(index = 16, value = "Quantity")
    private BigDecimal quantity;
    @ExcelProperty(index = 17, value = "Costing Method")
    private String costingMethod;
    @ExcelProperty(index = 18, value = "Mtl Bur Unit Cost")
    private String mtlBurUnitCost;
    @ExcelProperty(index = 19, value = "Material Costs")
    private BigDecimal materialCosts;
    @ExcelProperty(index = 20, value = "Lbr Unit Cost")
    private String lbrUnitCost;
    @ExcelProperty(index = 21, value = "Bur Unit Cost")
    private String burUnitCost;
    @ExcelProperty(index = 22, value = "Sub Unit Cost")
    private String subUnitCost;
    @ExcelProperty(index = 23, value = "Ext. Mtl Bur Unit Cost")
    private String extMtlBurUnitCost;
    @ExcelProperty(index = 24, value = "Ext. Mat Cost")
    private String extMatCost;

    /**
     * 目标计算值（数量 * 单价 绝对值）
     */
    private BigDecimal calResultValue;

    public BigDecimal getCalResultValue() {
        if (quantity != null && materialCosts != null) {
            return materialCosts.multiply(quantity).abs();
        }
        return BigDecimal.ZERO;
    }
}
